import requests
import datetime
import xlsxwriter
import time
import pymysql
from DBUtils.PooledDB import PooledDB
import threading
import math
import pandas as pd
from time import *

ID = "ww7b4086d88a144eec"
SECRET = "QqZ9Au1EwEDc1PyvcZaAgJBhaPDeK1z5zinENKHLL1Q"

url_get_access_token = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=" + ID + "&corpsecret=" + SECRET
def get_access_token(ID,SECRET):
    access_token_json = requests.get(url_get_access_token).json()
    print(access_token_json)
    while access_token_json['errcode'] != 0:
        get_access_token(ID, SECRET)
        time.sleep(2)
    access_token = access_token_json['access_token']
    return access_token


# access_token缓存
access_token = get_access_token(ID,SECRET)

url_get_unassigned_list = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/get_unassigned_list?access_token="+ access_token

